package cn.wolfcode.car.business.query;

import cn.wolfcode.car.common.base.query.QueryObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Service;

import java.util.Calendar;
import java.util.Date;

@Getter
@Setter
public class EmployeeQuery extends QueryObject {
    private String keyword;
    private Integer admin;
    private Integer status;
    private Long deptId;


    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endTime;

    // 指定时间中的最后一秒
    public Date getEndTime() {
        if (endTime == null) {
            return null;
        }
        Calendar cal = Calendar.getInstance();
        cal.setTime(endTime);
        cal.set(Calendar.HOUR_OF_DAY, 23);
        cal.set(Calendar.MINUTE, 59);
        cal.set(Calendar.SECOND, 59);
        return cal.getTime();
    }

}
